package com.mls.fivedistrict.common;

import com.baomidou.mybatisplus.mapper.Wrapper;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.BiConsumer;

/**
 * 通用的页面过滤
 * Created by chenxiuxiang on 2018/1/1.
 */
public class PageFilter {
    private int pageNum = 1;
    private int pageSize = 20;
    private String orderCause;
    private boolean distinct;
    private List<FilterBean> filters;
    private Map<String, String> filterMap = new HashMap<>();
//    @JsonIgnoreProperties(value = "wrapper", allowGetters = false, allowSetters = false)
    @JsonIgnore
    private Wrapper wrapper;

    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public List<FilterBean> getFilters() {
        return filters;
    }

    public void setFilters(List<FilterBean> filters) {
        this.filters = filters;
    }

    public Map<String, String> getFilterMap() {

        return filterMap;
    }

    public void setFilterMap(Map<String, String> filterMap) {
        this.filterMap = filterMap;
    }


    public String getOrderCause() {
        return orderCause;
    }

    public boolean isDistinct() {
        return distinct;
    }

    public void setDistinct(boolean distinct) {
        this.distinct = distinct;
    }

    public void setOrderCause(String orderCause) {
        this.orderCause = orderCause;
    }

    public Wrapper getWrapper() {
        return wrapper;
    }

    public void setWrapper(Wrapper wrapper) {
        this.wrapper = wrapper;
    }

    public static class FilterBean {
        private String key;
        private Object value;
        /**
         * 操作符
         */
        private String operator;

        public String getKey() {
            return key;
        }

        public void setKey(String key) {
            this.key = key;
        }

        public Object getValue() {
            return value;
        }

        public void setValue(Object value) {
            this.value = value;
        }

        public String getOperator() {
            return operator;
        }

        public void setOperator(String operator) {
            this.operator = operator;
        }
    }
}
